package io.xccit.race.service.impl;

import java.util.List;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import io.xccit.common.utils.DateUtils;
import io.xccit.common.utils.SecurityUtils;
import io.xccit.race.mapper.RaceCompetitionTeamMemberMapper;
import io.xccit.race.domain.RaceCompetitionTeamMember;
import io.xccit.race.service.IRaceCompetitionTeamMemberService;

/**
 * 团队报名成员Service业务层处理
 * 
 * @author ywx
 * @date 2025-10-11
 */
@Service
public class RaceCompetitionTeamMemberServiceImpl implements IRaceCompetitionTeamMemberService 
{
    @Autowired
    private RaceCompetitionTeamMemberMapper raceCompetitionTeamMemberMapper;

    /**
     * 查询团队报名成员
     * 
     * @param id 团队报名成员主键
     * @return 团队报名成员
     */
    @Override
    public RaceCompetitionTeamMember selectRaceCompetitionTeamMemberById(Long id)
    {
        return raceCompetitionTeamMemberMapper.selectRaceCompetitionTeamMemberById(id);
    }

    /**
     * 查询团队报名成员列表
     * 
     * @param raceCompetitionTeamMember 团队报名成员
     * @return 团队报名成员
     */
    @Override
    public List<RaceCompetitionTeamMember> selectRaceCompetitionTeamMemberList(RaceCompetitionTeamMember raceCompetitionTeamMember)
    {
        return raceCompetitionTeamMemberMapper.selectRaceCompetitionTeamMemberList(raceCompetitionTeamMember);
    }

    /**
     * 根据报名ID查询团队成员列表
     * 
     * @param signupId 报名ID
     * @return 团队成员集合
     */
    @Override
    public List<RaceCompetitionTeamMember> selectTeamMembersBySignupId(Long signupId)
    {
        return raceCompetitionTeamMemberMapper.selectTeamMembersBySignupId(signupId);
    }

    /**
     * 新增团队报名成员
     * 
     * @param raceCompetitionTeamMember 团队报名成员
     * @return 结果
     */
    @Override
    public int insertRaceCompetitionTeamMember(RaceCompetitionTeamMember raceCompetitionTeamMember)
    {
        raceCompetitionTeamMember.setCreateTime(new Date());
        raceCompetitionTeamMember.setDelFlag("0");
        return raceCompetitionTeamMemberMapper.insertRaceCompetitionTeamMember(raceCompetitionTeamMember);
    }

    /**
     * 修改团队报名成员
     * 
     * @param raceCompetitionTeamMember 团队报名成员
     * @return 结果
     */
    @Override
    public int updateRaceCompetitionTeamMember(RaceCompetitionTeamMember raceCompetitionTeamMember)
    {
        raceCompetitionTeamMember.setUpdateTime(new Date());
        return raceCompetitionTeamMemberMapper.updateRaceCompetitionTeamMember(raceCompetitionTeamMember);
    }

    /**
     * 批量删除团队报名成员
     * 
     * @param ids 需要删除的团队报名成员主键
     * @return 结果
     */
    @Override
    public int deleteRaceCompetitionTeamMemberByIds(Long[] ids)
    {
        return raceCompetitionTeamMemberMapper.deleteRaceCompetitionTeamMemberByIds(ids);
    }

    /**
     * 删除团队报名成员信息
     * 
     * @param id 团队报名成员主键
     * @return 结果
     */
    @Override
    public int deleteRaceCompetitionTeamMemberById(Long id)
    {
        return raceCompetitionTeamMemberMapper.deleteRaceCompetitionTeamMemberById(id);
    }

    /**
     * 根据报名ID删除所有团队成员
     * 
     * @param signupId 报名ID
     * @return 结果
     */
    @Override
    public int deleteTeamMembersBySignupId(Long signupId)
    {
        return raceCompetitionTeamMemberMapper.deleteTeamMembersBySignupId(signupId);
    }
}
